package kong_gui_items;

import java.awt.Component;
import java.awt.Graphics;
import java.util.LinkedList;

public class GraphicsPainters extends Component {

	LinkedList<BaseGraphics> itemsToPaint;
	private static final long serialVersionUID = 1L;


	public GraphicsPainters(LinkedList<BaseGraphics> itemsToPaint){
		this.itemsToPaint = itemsToPaint;
	}

	public void paint(Graphics g) {

		synchronized (this.itemsToPaint) {

			super.paint(g);
			for(BaseGraphics graphics : this.itemsToPaint)
			{
				graphics.paint(g);
			}
		}
	}

	public void setItemsToPaint(LinkedList<BaseGraphics> itemsToPaint) {

		synchronized (this.itemsToPaint) {
			this.itemsToPaint = null;
			this.itemsToPaint = itemsToPaint;
		}

	}

	public LinkedList<BaseGraphics> getItemsToPaint() {
		synchronized (this.itemsToPaint) {
			return itemsToPaint;
		}
	}
}
